﻿using RsCode;
using RsCode.AspNetCore.Jwt;

using Rswl.Common.Core.User.Aggregate.Entities;
using Rswl.Common.Core.User.Aggregate.ValueObject;
using System.Threading.Tasks;

namespace Rswl.Common.Core
{
    [ScopedService]
    public interface IUserDomainService
    {
        Task<UserInfo> PasswordRegisterAsync(PasswordRegisterValueObject value);
        Task<UserInfo> PasswordRegisterNoCheckAsync(PasswordRegisterValueObject value);

		Task<UserInfo> PasswordLoginAsync(PasswordLoginValueObject value);
        Task<UserInfo> PhoneRegisterAsync(PhoneRegisterValueObject value);
        Task<UserInfo> OtherAuthUserLoginAsync(OtherAuthUserValueObject value);
        Task<UserInfo> GetOrCreateUserAysnc(OAuthUserValueObject value);
        Task ChangePasswordAsync(string userId, string password, PasswordType passwordType = PasswordType.PwdLogin);
        UserInfo GetLoginUserInfo(string appId);
        /// <summary>
        /// 忘记密码
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        Task ForgetPasswordAsync(PasswordForgetValueObject value);
        /// <summary>
        /// 找回密码
        /// </summary>
        /// <param name="phone"></param>
        /// <param name="findType"></param>
        /// <returns></returns>
        Task<string> FindPasswordAsync(PasswordFindValueObject value);
        /// <summary>
        /// 获取安全码图片
        /// </summary>
        /// <returns></returns>
        Task<byte[]> GetSafeCodeImageAsync();
        Task ChangeRoleAsync(ChangeUserRole changeInfo);
        /// <summary>
        /// 创建用户token
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        AccessTokenInfo CreateUserAccessToken(UserInfo userInfo);
        /// <summary>
        /// 创建访客信息
        /// </summary>
        /// <returns></returns>
        AccessTokenInfo CreateVisitor();
        /// <summary>
        /// 短信登录
        /// </summary>
        /// <param name="phone"></param>
        /// <param name="sms"></param>
        /// <returns></returns>
        Task<UserInfo> SmsLoginAsync(string phone, string sms);

        /// <summary>
        /// 为连接创建登录二维码
        /// </summary>
        /// <param name="connId"></param>
        /// <returns></returns>
        Task<string> CreateLoginQrCodeAsync(string connId);

        Task<AccessTokenInfo> AdminLoginAsync(PasswordLoginValueObject value);

        Task<long> SaveShippingAddressAsync(string userId,ShippingAddressInfo info);
        Task RemoveShippingAddressAsync(string userId, long addressId);

        Task BindInviteCode(string userId, string code);
        

        Task ChangeUserGradeAsync(string userId, UserGrade grade);


        Task<UserInfo> ChangeAvatarAsync(ChangeUserInfo userInfo);

        Task CheckOpenRegisterAsync();

        Task ChangeSatusAsync(string userId, int status);
	}
}